home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / banner / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.2 KB  |  104 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Banner.h"
  6. #include "MainFrm.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. // Array tbSTDButton contains relevant buttons of bitmap IDB_STD_SMALL_COLOR
  14.  
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CMainFrame
  18.  
  19. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  20.  
  21. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  22.     //{{AFX_MSG_MAP(CMainFrame)
  23.     ON_WM_CREATE()
  24.     ON_WM_DESTROY()
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CMainFrame construction/destruction
  30.  
  31. CMainFrame::CMainFrame()
  32. {
  33. }
  34.  
  35. CMainFrame::~CMainFrame()
  36. {
  37. }
  38.  
  39. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  40. {
  41.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  42.         return -1;
  43.  
  44.     if(!m_wndCommandBar.Create(this) ||
  45.        !m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME))
  46.     {
  47.         TRACE0("Failed to create CommandBar\n");
  48.         return -1;      // fail to create
  49.     }
  50.  
  51.     // Create a combo box and attach it to our own CComboBox derivitive
  52.     CComboBox* pCB = m_wndCommandBar.InsertComboBox(m_wndZoomList.GetWidth(), 1001);
  53.     if(pCB == NULL)
  54.     {
  55.         TRACE0("Failed to create combo box\n");
  56.         return -1;      // fail to create
  57.     }
  58.  
  59.     HWND hWndCB = pCB->m_hWnd;
  60.     pCB->Detach();
  61.     m_wndZoomList.Attach(hWndCB);
  62.     m_wndZoomList.Initialize();
  63.  
  64.     // Add Exit button
  65.     if (!m_wndCommandBar.AddAdornments())
  66.     {
  67.         TRACE0("Failed to add adornment\n");
  68.         return -1;      // fail to create
  69.     }
  70.  
  71.     return 0;
  72. }
  73.  
  74. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  75. {
  76.     return CFrameWnd::PreCreateWindow(cs);
  77. }
  78.  
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CMainFrame diagnostics
  81.  
  82. #ifdef _DEBUG
  83. void CMainFrame::AssertValid() const
  84. {
  85.     CFrameWnd::AssertValid();
  86. }
  87.  
  88. void CMainFrame::Dump(CDumpContext& dc) const
  89. {
  90.     CFrameWnd::Dump(dc);
  91. }
  92.  
  93. #endif //_DEBUG
  94.  
  95. /////////////////////////////////////////////////////////////////////////////
  96. // CMainFrame message handlers
  97.  
  98.  
  99. void CMainFrame::OnDestroy() 
  100. {
  101.     m_wndZoomList.Detach();
  102.     CFrameWnd::OnDestroy();
  103. }
  104.